import { stat } from 'fs'
import request from '../../utils/request.js'
const state = {
	homeInfo:{}
}

const actions = {
	// 1. 获取主页面中的数据
	async getHomeInfoData({commit}){
		try{
			const result =await request({url:'/getIndexData'})
			console.log('home',result)
			commit('SET_HOME_INFO_DATA',result)
		}catch(e){

			console.log(e)
		}
	}
}

const mutations = {
	// 1. 给homeInfo对象 赋值
	SET_HOME_INFO_DATA(state,result){
		state.homeInfo = result
	}
}

const getters = {
	// 1. 获取导航标签项
	navList(state){
		return (state.homeInfo.kingKongModule || {}).kingKongList || []
	}
}

export default {
	namespaced: true,
	state,
	actions,
	mutations,
	getters
}